package action.vo;




public class IdName {
	
	private String name;
	private String id;
	private String code;
	private String prefix;
	
	public IdName(){
		
	}
	public IdName(String id,String name){
		this.id = id;
		this.name = name;
	}
	public IdName(String id,String name,String prefix){
		this.id = id;
		this.name = name;
		this.prefix = prefix;
	}
	
	public IdName(String id,String name,String prefix,String code){
		this.id = id;
		this.name = name;
		this.code = code;
		this.prefix = prefix;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public String getPrefix() {
		return prefix;
	}
	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}
	
	public boolean equals (Object obj) {
		
		if (null == obj) return false;
		if (!(obj instanceof IdName)) return false;
		else {
			IdName category = (IdName) obj;
			if (null == this.getId() || null == category.getId()) return false;
			else if(this.getPrefix()!=null) return (this.getId().equals(category.getId()) 
					&& this.getPrefix().equals(category.getPrefix()));
			else return (this.getId().equals(category.getId()));
		}
	}
	
	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}
	public String toString () {
		return this.getPrefix() +  this.getId();
	}

	public int hashCode = Integer.MIN_VALUE;
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
}
